package com.zhike;

import java.util.Arrays;
import java.util.Scanner;

public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param root TreeNode类 
     * @return int整型一维数组
     */
    public int[] inorderTraversal (TreeNode root) {
        Scanner scanner = new Scanner(System.in);
        String[] input = scanner.next().split(",");
        int[] res =new int[100];
        TreeNode order = order(input);
        tt(root,res);
        return res;
    }

    private void tt(TreeNode root, int[] res) {
        if (res==null){
            return;
        }
    }

    private TreeNode order(String[] input) {
        if (input==null||input.length==0||input[0].equals("#")){
            return null;
        }
        TreeNode root = new TreeNode(Integer.parseInt(input[0]));
        int index = 1;
        root.left=order(Arrays.copyOfRange(input,index,input.length));
        while(index<input.length && !input[index].equals("#")){
            index++;
        }
        index ++;
        root.right=order(Arrays.copyOfRange(input,index,input.length));
        return root;
    }


    public class TreeNode {
        int val = 0;
        TreeNode left = null;
        TreeNode right = null;

        public TreeNode(int val) {
            this.val = val;
        }
    }
}